﻿/**
 * @file		dd_ipcu.h
 * @brief		IPCU (Inter-Processor Communications Unit) driver
 * @note		None
 * @attention	None
 * 
 * <B><I>Copyright 2016 Socionext Inc.</I></B>
 */

/** @weakgroup dd_ipcu_overview
@{
	CM0 IPCU Driver.<br>
	<br>
	Although IPCU unit are mounted two, for use in the CM0 is only IPCU1.<br>
	Interrupt signal of IPCU that can be used for communication between the CA7 and CM0 is from 12 to 15.<br>
@}*//* --- end of dd_ipcu_overview */

/** @weakgroup dd_ipcu_sequence
@{
	- @ref dd_ipcu_send_sequence_sect
	- @ref dd_ipcu_receive_sequence_sect
	- @ref dd_ipcu_sample_section1
	- @ref dd_ipcu_sample_section2
	- @ref dd_ipcu_sample_section3
	@section dd_ipcu_send_sequence_sect		Sequence example of data send on IPCU.
	@image html ipcu_send.png
	@section dd_ipcu_receive_sequence_sect	Sequence example of data receive on IPCU.
	@image html ipcu_receive.png
	@section dd_ipcu_sample_section1	Sample of "Data Send".
    @code
	#define IPCU_CPU1_USED_MB_NUM		(6)			// 6 boxes for CPU1
	#define IPCU_MB_MAX					(8)			// total number of Mail Boxes
	#define IPCU_MB_DATA_MAX			(9)			// number of data in a Mail Box
	
	INT32 Send_Request( ULONG src_num, ULONG dst_num, ULONG* data )
	{
		UINT32 mb_num;
		ULONG mb_status;
		INT32 i;
		
		// Search free Mail Box
		Dd_IPCU_Get_MB_Stat( &mb_status );
		for( mb_num = IPCU_CPU0_USED_MB_NUM; mb_num < IPCU_MB_MAX; mb_num++ ) {
			if( 0 == (1 & mb_status) ) {
				break;
			}
			mb_status >>= 1;
		}
		if (mb_num >= IPCU_MB_MAX) {
			// All of the mailbox is in use.
			return D_NG;
		}
		
		// Set Acknowledge callback.
		Dd_IPCU_Set_Ack_CB( mb_num, (VP_CALLBACK)Receive_Acknowledge);
		
		// Set Mail Box
		Dd_IPCU_Set_MB_Src( mb_num, src_num );
		
		// Set destination
		Dd_IPCU_Set_MB_Dst_Unit( mb_num, dst_num);
		
		// Set mode.
		Dd_IPCU_Set_MB_Mode( mb_num, E_DD_IPCU_MB_MODE_MANUAL_1 );
		
		// Set Data
		for( i = 0; i < IPCU_MB_DATA_MAX; i++ ) {
			Dd_IPCU_Set_MB_Data( mb_num, i, *data );
			data++;
		}
		
		// Start sending
		Dd_IPCU_Set_MB_Send( mb_num, 1 );
		
		return D_OK;
	}
    @endcode
	<br>
	@section dd_ipcu_sample_section2	Sample of "Receive Config - Receiving Request".
    @code
	
	ULONG gIPCU_Receive_Data[IPCU_MB_DATA_MAX];
	
	//
	// Receiving side setting.
	// Input parameter:mb_num to specify the same number as the sender.
	//
	VOID IPCU_Receive_Config( UINT32 mb_num )
	{
		// Set Request callback.
		Dd_IPCU_Set_Req_CB( mb_num, (VP_CALLBACK)Receive_Request );
	}
	
	//
	// This function is called from IPCU Interrupt handler.
	//
	INT32 Receive_Request( ULONG ch )
	{
		ULONG mb_num;
		INT32 i;
		
		// Get Mail Box Number
		mb_num = (Dd_IPCU_Get_MB_Adr(ch) - 0x100) >> 7;
		
		// Get Data
		for( i = 0; i < IPCU_MB_DATA_MAX; i++ ) {
			Dd_IPCU_Get_MB_Data( mb_num, i, &(gIPCU_Receive_Data[i]) );
		}
		
		// Clear destination ---> Send acknowledge.
		Dd_IPCU_Clr_MB_Dst_Unit( mb_num, ch );
		
		return D_OK;
	}
    @endcode
	<br>
	@section dd_ipcu_sample_section3	Sample of "Receiving Acknowledge(Callback)".
    @code
	//
	// This function is called from IPCU Interrupt handler.
	//
	INT32 Receive_Acknowledge( ULONG ch )
	{
		ULONG mb_num;
		ULONG ack_reg;
		
		// Get Mail Box Number
		mb_num = (Dd_IPCU_Get_MB_Adr(ch) - 0x100) >> 7;
		
		// Read acknowlegde status
		Dd_IPCU_Get_MB_Ack_Stat( mb_num, &ack_reg );
		
		// Clear acknowlegde
		Dd_IPCU_Clr_MB_Ack( mb_num, ack_reg );
		
		// Release Mail Box
		Dd_IPCU_Set_MB_Src( mb_num, 0 );
		
		return D_OK;
	}
    @endcode

@}*//* --- end of dd_ipcu_sequence */

#ifndef _DD_IPCU_H_
#define _DD_IPCU_H_

/** @weakgroup dd_ipcu_definition
@{*/

#include "arm.h"
#include "driver_common.h"

/*----------------------------------------------------------------------*/
/* Definition															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
#define D_DD_IPCU_MB_TOTAL_NUM					(8)										/**< Total Number of Mailboxes */
#define D_DD_IPCU_MB_MAX						(D_DD_IPCU_MB_TOTAL_NUM - 1)			/**< Mailbox Max Value */
#define D_DD_IPCU_MB_DATA_TOTAL_NUM				(9)										/**< Total Number of Mailbox Data */
#define D_DD_IPCU_MB_DATA_MAX					(D_DD_IPCU_MB_DATA_TOTAL_NUM - 1)		/**< Mailbox Data Max Value */
#define D_DD_IPCU_INT_MAX						(15)									/**< Interrupt Channel Max Value */

/* Return value of IPCU processing result */
#define D_DD_IPCU_INPUT_PARAM_ERR				(D_DD_IPCU | D_DDIM_INPUT_PARAM_ERROR)	/**< Input parameter error		*/
#define D_DD_IPCU_STATUS_ABNORMAL				(D_DD_IPCU | D_DDIM_STATUS_ABNORMAL)	/**< IPCU status error			*/
#define D_DD_IPCU_MB_BUSY						(D_DD_IPCU | D_DDIM_DATA_EXIST_ERROR)	/**< IPCU Mailbox busy			*/
#define D_DD_IPCU_WAIT_TIMEOUT					(D_DD_IPCU | D_DDIM_TIMEOUT)			/**< IPCU wait timeout error	*/


#define D_DD_IPCU_STATE_NONE					(0)										/**< IPCU not used				*/
#define D_DD_IPCU_STATE_KEEP					(1)										/**< IPCU set and not send		*/
#define D_DD_IPCU_STATE_BF_ACT					(2)										/**< IPCU send from BaseFW		*/
#define D_DD_IPCU_STATE_HOST_ACT				(4)										/**< IPCU send from Host		*/

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special

#endif //CO_DDIM_UTILITY_USE

/*----------------------------------------------------------------------*/
/* Enumeration															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
/** IPCU Mailbox Mode */
typedef enum {
	E_DD_IPCU_MB_MODE_MANUAL_1 = 0,		/**< 000b:Manual Mode 1 	*/
	E_DD_IPCU_MB_MODE_MANUAL_2,			/**< 001b:Manual Mode 2 	*/
	E_DD_IPCU_MB_MODE_AUTO_ACK_1,		/**< 010b:Auto Acknowledge Mode 1 */
	E_DD_IPCU_MB_MODE_AUTO_ACK_2,		/**< 011b:Auto Acknowledge Mode 2 */
	E_DD_IPCU_MB_MODE_AUTO_CLEAR,		/**< 100b:Auto Clear Mode 	*/
	E_DD_IPCU_MB_MODE_MAX
} E_DD_IPCU_MB_MODE;

/** IPCU enable bit */
typedef enum {
	E_DD_IPCU_MB_ENABLE_0 = 0x01,		/**< IPCU enable bit Bit0(00000001b) */
	E_DD_IPCU_MB_ENABLE_1 = 0x02,		/**< IPCU enable bit Bit1(00000010b) */
	E_DD_IPCU_MB_ENABLE_2 = 0x04,		/**< IPCU enable bit Bit2(00000100b) */
	E_DD_IPCU_MB_ENABLE_3 = 0x08,		/**< IPCU enable bit Bit3(00001000b) */
	E_DD_IPCU_MB_ENABLE_4 = 0x10,		/**< IPCU enable bit Bit4(00010000b) */
	E_DD_IPCU_MB_ENABLE_5 = 0x20,		/**< IPCU enable bit Bit5(00100000b) */
	E_DD_IPCU_MB_ENABLE_6 = 0x40,		/**< IPCU enable bit Bit6(01000000b) */
	E_DD_IPCU_MB_ENABLE_7 = 0x80,		/**< IPCU enable bit Bit7(10000000b) */
	E_DD_IPCU_MB_ENABLE_MAX
} E_DD_IPCU_MB_ENABLE;


#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special

#endif //CO_DDIM_UTILITY_USE

/*----------------------------------------------------------------------*/
/* Structure  															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
/** IPCU management table structure */
typedef struct {
	E_DD_IPCU_MB_MODE	mode;				/**< Mailbox mode			*/
	ULONG				src_ch_num;			/**< Source reg.			*/
	ULONG				dst_ch_num;			/**< Dest reg.				*/
	ULONG				mask_ch_num;		/**< Mask ch No.			*/
	ULONG				send_data[9];		/**< Send data				*/
	ULONG				data_size;			/**< Send data size			*/
	VP_CALLBACK			ack_func;			/**< ACK function pointer	*/
	VP_CALLBACK			req_func;			/**< Req function pointer	*/
} T_DD_IPCU_MNG;


#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special

#endif //CO_DDIM_UTILITY_USE

/*----------------------------------------------------------------------*/
/* Global Data															*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
// Nothing Special

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special

#endif //CO_DDIM_UTILITY_USE

/*----------------------------------------------------------------------*/
/* Macro																*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
// Nothing Special

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special

#endif //CO_DDIM_UTILITY_USE

/* @} */	// dd_ipcu_definition group

/** @weakgroup dd_ipcu_api
@{*/
/*----------------------------------------------------------------------*/
/* Function																*/
/*----------------------------------------------------------------------*/
//---------------------------- driver section ----------------------------
#ifdef __cplusplus
extern "C" {
#endif

/**
Set IPCU operation condition and callback function for designated IPCU unit and Mailbox.
@param [in] id		IPCU ID(0 to 7)
@param [in]	ipcu_mng	IPCU Control data. See @ref T_DD_IPCU_MNG.
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Ctrl( UCHAR id, T_DD_IPCU_MNG const* const ipcu_mng );

/**
Get IPCU operation condition and callback function for designated IPCU unit and Mailbox.
@param [in]  id		IPCU ID(0 to 7)
@param [out] ipcu_mng	IPCU Control data. See @ref T_DD_IPCU_MNG.
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_Ctrl( UCHAR id, T_DD_IPCU_MNG *const ipcu_mng );

/**
Start sending data.
@param [in]  id		IPCU ID(0 to 7)
@param [in]  state	State of IPCU<br>
					<ul><li>@ref D_DD_IPCU_STATE_NONE
						<li>@ref D_DD_IPCU_STATE_KEEP
						<li>@ref D_DD_IPCU_STATE_BF_ACT
						<li>@ref D_DD_IPCU_STATE_HOST_ACT</ul>
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Start( UCHAR id, UCHAR state );

/**
It is Interrupt Handler of IPCU acknoeledge.<br>
@param [in] int_ch	Interrupt CH number(12 to 15)
*/
extern VOID Dd_IPCU_Int_Handler( UINT32 int_ch );

/**
Set Acknowledge callback function.
@param [in] id		IPCU ID(0 to 7)
@param [in] p_callback	Callback function of Acknowledge
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_Ack_CB( UCHAR id, VP_CALLBACK p_callback );

/**
Set Request callback function.
@param [in] id		IPCU ID(0 to 7)
@param [in] p_callback	Callback function of Request
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_Req_CB( UCHAR id, VP_CALLBACK p_callback );

/**
Get Interrupt Status
@param [in] ch		IPCU Interrupt CH number(12 to 15)
@param [out] state  Interrupt Status
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_Int_Stat( UCHAR ch, ULONG* state );

/**
Get Interrupt Status indicated by Mailbox Number
@param [in] ch		IPCU Interrupt CH number(12 to 15)
@param [in] mb_num	Mailbox number
@param [out] state	Interrupt Status
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_Int_Stat_MB( UCHAR ch, UCHAR mb_num, ULONG *state );

/**
Get Acknowledge status
@param [in] ch		IPCU Interrupt CH number(12 to 15)
@param [out] ack	Acknowledge Status
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Ack( UCHAR ch, ULONG *ack );

/**
Get Request status
@param [in] ch		IPCU Interrupt CH number(12 to 15)
@param [out] req	Request Status
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Req( UCHAR ch, ULONG *req );

/**
Get Mailbox Address
@param [in] ch		IPCU Interrupt CH number(12 to 15)
@param [out] mba	Mailbox Address
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Adr( UCHAR ch, ULONG *mba );

/**
Get Source information
@param [in] num		Mailbox number(0 to 7)
@param [out] src 	Request transmit source
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Src( ULONG num, ULONG *src );

/**
Get Source information indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] src_ch	Interrupt ch of IPCU(12 to 15)
@param [out] src 	Request transmit source
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Src_Unit( ULONG num, UCHAR src_ch, ULONG *src );

/**
Set Source information
@param [in] num		Mailbox number(0 to 7)
@param [in] src 	Request transmit source.<br>
					bit0~11 : 0 (Fixed).<br>
					bit12~15 : 0(not request transmit) / 1(request transmit).
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Set_MB_Src( ULONG num, ULONG src );

/**
Get Mode information
@param [in] num		Mailbox number(0 to 7)
@param [out] mode 	Operation mode
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Mode( ULONG num, ULONG *mode );

/**
Set Mode information
@param [in] num		Mailbox number(0 to 7)
@param [in] mode 	Operation mode
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Set_MB_Mode( ULONG num, E_DD_IPCU_MB_MODE mode );

/**
Get Send trigger
@param [in] num		Mailbox number(0 to 7)
@param [out] send 	Send trigger
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Send( ULONG num, ULONG *send );

/**
Set Send trigger
@param [in] num		Mailbox number(0 to 7)
@param [in] send 	Send trigger (0:OFF, 1:ON)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_MB_Send( ULONG num, ULONG send );

/**
Set Destination information
@param [in] num		Mailbox number(0 to 7)
@param [in] dst 	Request transmit destination
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_MB_Dst( ULONG num, ULONG dst );

/**
Set Destination information indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] dst_ch 	Request transmit destination ch(12 to 15)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_MB_Dst_Unit( ULONG num, ULONG dst_ch );

/**
Clear Destination information
@param [in] num		Mailbox number(0 to 7)
@param [in] dst 	Request transmit destination by bit data
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Clr_MB_Dst( ULONG num, ULONG dst );

/**
Clear Destination information indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] dst_ch 	Request transmit destination ch(12 to 15)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
 */
extern INT32 Dd_IPCU_Clr_MB_Dst_Unit( ULONG num, UCHAR dst_ch );

/**
Get Destination information
@param [in] num		Mailbox number(0 to 7)
@param [out] dst 	Request transmit destination by bit data
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Dst_Stat( ULONG num, ULONG *dst );

/**
Get Destination information indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] dst_ch 	Request transmit destination ch(12 to 15)
@param [out] dst 	Request transmit destination by bit data
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Dst_Stat_Unit( ULONG num, UCHAR dst_ch, ULONG *dst );

/**
Set Mask request
@param [in] num		Mailbox number(0 to 7)
@param [in] msk 	Mask request
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_MB_Msk( ULONG num, ULONG msk );

/**
Set Mask request indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] msk_ch 	Request mask ch(12 to 15)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
 */
extern INT32 Dd_IPCU_Set_MB_Msk_Unit( ULONG num, ULONG msk_ch );

/**
Clear Mask request
@param [in] num		Mailbox number(0 to 7)
@param [in] msk 	Mask request
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Clr_MB_Msk( ULONG num, ULONG msk );

/**
Clear Mask request indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] msk_ch 	Request mask ch(12 to 15)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Clr_MB_Msk_Unit( ULONG num, ULONG msk_ch );

/**
Get Mask request status
@param [in] num		Mailbox number(0 to 7)
@param [out] msk 	Mask request
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Msk_Stat( ULONG num, ULONG *msk );

/**
Get Mask request indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] msk_ch 	Request mask ch(12 to 15)
@param [out] msk 	Mask request
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
extern INT32 Dd_IPCU_Get_MB_Msk_Stat_Unit( ULONG num, ULONG msk_ch, ULONG *msk );

/**
Set Acknowledge
@param [in] num		Mailbox number(0 to 7)
@param [in] ack 	Acknowledge
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Set_MB_Ack( ULONG num, ULONG ack );

/**
Set Acknowledge indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] ack_ch 	Acknowledge ch(12 to 15)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
 */
extern INT32 Dd_IPCU_Set_MB_Ack_Unit( ULONG num, ULONG ack_ch );

/**
Clear Acknowledge indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] ack 	Acknowledge
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
 */
extern INT32 Dd_IPCU_Clr_MB_Ack( ULONG num, ULONG ack );

/**
Clear Acknowledge indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] ack_ch 	Acknowledge ch(12 to 15)
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
extern INT32 Dd_IPCU_Clr_MB_Ack_Unit( ULONG num, ULONG ack_ch );

/**
Get Acknowledge status
@param [in] num		Mailbox number(0 to 7)
@param [out] ack 	Acknowledge
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
INT32 Dd_IPCU_Get_MB_Ack_Stat( ULONG num, ULONG *ack );

/**
Get Acknowledge indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] ack_ch 	Acknowledge ch(12 to 15)
@param [out] ack 	Acknowledge
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
INT32 Dd_IPCU_Get_MB_Ack_Stat_Unit( ULONG num, ULONG ack_ch, ULONG *ack );

/**
Get Acknowledge source information
@param [in] num		Mailbox number(0 to 7)
@param [out] ack 	Acknowledge  source
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
INT32 Dd_IPCU_Get_MB_Ack_Src( ULONG num, ULONG *ack );

/**
Get Source information indicated by IPCU ch
@param [in] num		Mailbox number(0 to 7)
@param [in] ack_ch	Interrupt ch of IPCU(12 to 15)
@param [out] ack  	Acknowledge source
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
@retval		D_DD_IPCU_STATUS_ABNORMAL	: IPCU status error
*/
INT32 Dd_IPCU_Get_MB_Ack_Src_Unit( ULONG num, ULONG ack_ch, ULONG *ack );

/**
Get Transfer data
@param [in] num		Mailbox number(0 to 7)
@param [in] dat_num	Transfer data No(0 to 8).
@param [out] data 	Transfer data
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
INT32 Dd_IPCU_Get_MB_Data( ULONG num, UCHAR dat_num, ULONG *data );

/**
Set Transfer data
@param [in] num		Mailbox number(0 to 7)
@param [in] dat_num	Transfer data No(0 to 8).
@param [in] data 	Transfer data
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
INT32 Dd_IPCU_Set_MB_Data( ULONG num, UCHAR dat_num, ULONG data );

/**
Get MailBox status
@param [out] mb_stat 	MailBox status
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
*/
INT32 Dd_IPCU_Get_MB_Stat( ULONG *mb_stat );

/**
Get Mailbox Status indicated by Mailbox Number
@param [in] num		Mailbox number(0 to 7)
@param [out] mb_stat MailBox status
@retval		D_DDIM_OK					: OK
@retval		D_DD_IPCU_INPUT_PARAM_ERR	: Input parameter error
 */
INT32 Dd_IPCU_Get_MB_Stat_MB( ULONG num, ULONG *mb_stat );

#ifdef CO_DDIM_UTILITY_USE
//---------------------------- utility section ---------------------------
// Nothing Special
//---------------------------- colabo section ----------------------------
// Nothing Special

#endif //CO_DDIM_UTILITY_USE

#ifdef __cplusplus
}
#endif

/* @} */	// dd_ipcu_api group

#endif	// _DD_IPCU_H_

